import Vue from 'vue'
import VueRouter from 'vue-router'

import beforlogin from '@/views/login/beforlogin.vue'
import login from '@/views/login/login.vue'
import first from '@/views/login/first.vue'
import home from '@/views/home/home.vue'
import my from '@/views/home/my/my.vue'
import index from '@/views/home/index/index.vue'
import question from '@/views/home/question/question.vue'
import video from '@/views/home/video/video.vue'
import search from '@/views/search/search'
import searchResult from '@/views/search/searchResult'
import detail from '@/views/detail/detail'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/first'
  },
  {
    path: '/beforlogin',
    component: beforlogin
  },
  {
    path: '/login',
    component: login
  },
  {
    path: '/checkLogin',
    component: login
  },
  {
    path: '/first',
    component: first
  },
  {
    path: '/home',
    component: home,
    children: [
      { path: '/', redirect: '/my' },
      { path: '/index', component: index },
      { path: '/question', component: question },
      { path: '/video', component: video },
      { path: '/my', component: my }
    ]
  },
  {
    path: '/search',
    component: search
  },
  {
    path: '/searchResult/:key',
    component: searchResult
  },
  {
    path: '/detail/:artid',
    component: detail
  }
]

const router = new VueRouter({
  routes
})

export default router
